package com.weibo.dip.docker;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.InspectContainerResponse;
import com.github.dockerjava.core.DockerClientBuilder;

/** Created by haisen on 2018/7/18. */
public class Containerinfo {
  private static final String id = "740394b2e570";

  private static void show(String[] args) {
    for (String str : args) {
      System.out.print(str);
    }
    System.out.println();
  }

  public static void main(String[] args) {
    DockerClient dockerClient = DockerClientBuilder.getInstance().build();

    InspectContainerResponse inspectContainer = dockerClient.inspectContainerCmd(id).exec();

    System.out.print("Args --->> ");
    show(inspectContainer.getArgs());

    System.out.println("Config -->> " + inspectContainer.getConfig());

    System.out.println("Created -->> " + inspectContainer.getCreated());

    System.out.println("Driver -->> " + inspectContainer.getDriver());

    System.out.println("ExecDriver -->> " + inspectContainer.getExecDriver());

    System.out.println("HostConfig -->> " + inspectContainer.getHostConfig());

    System.out.println("RestartCount -->> " + inspectContainer.getRestartCount());

    System.out.println("State -->> " + inspectContainer.getState());

    System.out.println("Status -->> " + inspectContainer.getState().getStatus());

    System.out.println("Running -->> " + inspectContainer.getState().getRunning());

    System.out.println("Paused -->> " + inspectContainer.getState().getPaused());

    System.out.println("Dead -->> " + inspectContainer.getState().getDead());

    System.out.println("ExitCode -->> " + inspectContainer.getState().getExitCode());

    System.out.println("Error -->> " + inspectContainer.getState().getError());

  }
}
